package com.gump.essay.demo.design.gczms;

import javafx.beans.InvalidationListener;

import java.util.Observable;
import java.util.Observer;

/**
 * 观察者
 *
 * @auther zzc
 * @date 2020/12/9 16:23
 */
public class Author implements Observer {

    private String name;

    public Author(String name) {
        this.name = name;
    }

    @Override
    public void update(Observable o, Object arg) {
        Blog blog = (Blog) o;
        Comment comment = (Comment) arg;
        System.out.println("系统感知到"+this.name+"写的博客："+blog.getTitle()+"收到了"+comment.getNickname()+"的评论："+comment.getValue());
    }
}
